package packaging.homework2;

import java.util.Arrays;
import java.util.Scanner;
public class StudentBiz {
    public static void main(String[] args) {
        Student stu =new Student();
        Scanner input =new Scanner(System.in);
        System.out.println("欢迎使用学生管理系统");
        int num2=1;
        do {
            System.out.print("\t1.添加学生信息;\n\t2.删除学生信息;\n\t3.打印学生信息;\n\n请选择：");
            int num=input.nextInt();
            switch (num){
                case 1:
                    for (int i = 0; i <stu.stuList.length ; i++) {
                        Student stuList[] =new Student[stu.stuList.length];
                        System.out.print("请输入学生的学号：");
                        String id = stu.setId(input.next());
                        System.out.print("请输入学生的姓名：");
                        String name = stu.setName(input.next());
                        System.out.print("请输入学生的年龄：");
                        int age = stu.setAge(input.nextInt());
                        System.out.print("请输入学生的性别：");
                        String sex = stu.setSex(input.next());
                        System.out.print("请输入学生的爱好：");
                        String hobby = stu.setHobby(input.next());
                        stuList[i] = new Student(id, name, age, sex, hobby);
                        stu.addStudentDate(stuList[i]);
                        stu.printStudent();
                        System.out.print("是否继续添加学生信息？y/n：");
                        String answer=input.next();
                        if (answer.equals("n")){
                            System.out.print("输入0返回主菜单：");
                            num2=input.nextInt();
                            break;
                        }else{
                            continue;
                        }
                    }
                    break;
                case 2:
                    System.out.print("请输入删除学生的学号：");
                    String  deleteId=input.next();
                    stu.deleteStudent(deleteId);
                    stu.printStudent();
                    System.out.print("输入0返回主菜单：");
                    num2=input.nextInt();
                    break;
                case 3:
                    stu.printStudent();
                    System.out.print("输入0返回主菜单：");
                    num2=input.nextInt();
                    break;
            }
        }while(num2==0);
    }
}
